package com.google.monkeyjump.ranking;

public class Rank {
	private static final int CLASSSIFICATION_DELIMITER = 50;
	private long points;
	private String user;
	private Classification classification;

	public Rank() {
		this.user = "";
		this.setPoints(0);
	}

	public long getPoints() {
		return points;
	}

	public void setPoints(long points) {
		if (points >= 0) {
			this.points = points;
			calculateRank(points);
		}
	}

	public Classification getClassification() {
		return classification;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		if (user != null) {
			this.user = user;
		}
	}

	private void calculateRank(long points2) {
		int classificationIndex = (int) (points2 / CLASSSIFICATION_DELIMITER);

		this.classification = Classification
				.getClassification(classificationIndex);
	}

}
